<?php require "header.php" ?>
	<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?=$GOOGLE_KEY?>" type="text/javascript"></script>
	<script src="<?=$JAVASCRIPT_DIR?>stats_map.js" type="text/javascript"></script>

<?php
	// get cametrics url and initialize
	require_once($INCLUDE_DIR.'cametrics.helper.php');
	$url = Cametrics::getURL();

	// get user contributions
	$raw = @file_get_contents("$url/contributions/stats/hits?order=desc");
	$hits = json_decode($raw, true);
	// get number of contributors
	$count = count($hits);

	// get top contributor
	$top = array('imei' => false);
	if (count($hits)){
		$top['imei'] = $hits[0][0];
	}
?>

	<script type="text/javascript">
		document.observe("dom:loaded", function() {
		// initially hide all containers for tab content
		initialize('map_canvas');

		var invasives = ['Harding grass', 'Perennial pepperweed', 'Poison hemlock<br>', 'Spanish broom', 'Terracina spurge', 'Yellow starthistle'];
		var colors = ['red', 'green', 'blue', 'purple', 'gray', 'orange'];
		var legendoutput = '<center>&nbsp;';

		for (var loopr=0; loopr < invasives.length; loopr++)
		{
			legendoutput += '<strong><font color="' + colors[loopr] + '">' + invasives[loopr] + '</font></strong> &nbsp; ';
			}
			legendoutput += '</center>'
			$('map_legend').update(legendoutput);

		});
	</script>

<?php require "nav.php" ?>
<!-- Begin replaced content -->
	<div id="messages" class="span-24 last"></div>
	<div id="main" class="span-24 last">

<!-- Begin top statistics -->

		<div id="headertext" class="span-24 last center">&nbsp;</div>
		<div class="span-24 last center">
			<h2 style="font-size: 1.8em;"><span class="colorattention"><strong><?= @file_get_contents("$url/contributions/stats/count") ?></strong></span> Weeds Found!
			&nbsp; | &nbsp;
			<span class="colorattention"><strong><?= $count ?></strong></span> People Helping!
			&nbsp; | &nbsp; 
			<span class="colorattention"><strong><?= $top['imei'] ?></strong></span> is the Top Collector!
			</h2>

			<hr />
		</div>

	<!-- Begin left list of invasive species -->

		<div class="span-11 center" style="background-color:white;">
			<img src="<?=$IMAGE_DIR?>top6.png"><br />
			<span class="center navblack"><a href="plants.php"><h3><strong>Be On The Lookout!</strong></h3></a></span>
			<div class="span-1 center">&nbsp;</div>
			<div class="span-3 center">
				<a href="plants.php?plant=harding_grass"><img height="150" width="100" src="species_images/harding_grass_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Harding grass</strong></span>
			</div>
			<div class="span-3 center">
				<a href="plants.php?plant=perennial_pepperweed"><img height="150" width="100" src="species_images/perennial_pepperweed_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Perennial Pepperweed</strong></span>
			</div>
			<div class="span-3" align="center">
				<a href="plants.php?plant=poison_hemlock"><img height="150" width="100" src="species_images/poison_hemlock_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Poison hemlock</strong></span>
			</div>
			<div class="span-1 last center">&nbsp;</div>
			<div class="span-11 last">&nbsp;</div>
			<div class="span-1" align="center">&nbsp;</div>
			<div class="span-3 center">
				<a href="plants.php?plant=spanish_broom"><img height="150" width="100" src="species_images/spanish_broom_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Spanish Broom</strong></span>
			</div>
			<div class="span-3 center">
				<a href="plants.php?plant=terracina_spurge"><img height="150" width="100" src="species_images/terracina_spurge_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Terracina spurge</strong></span>
			</div>
			<div class="span-3 center">
				<a href="plants.php?plant=yellow_starthistle"><img height="150" width="100" src="species_images/yellow_starthistle_sm.png"/></a>
				<br/>
				<span class="h4_size"><strong>Yellow Starthistle</strong></span>
			</div>
			<div class="span-1" last align="center">&nbsp;</div>
		</div>

<!-- Begin right map -->

		<div id="main" class="span-12 last center" style="overflow: hidden">
			<h3><strong>Santa Monica Mountains National Recreation Area</strong></h3>
			<div id="map_canvas" style="width: 470px; height: 450px"></div>
			<div id="map_legend" style="width: 470px; height: 35px"></div>
		</div>

	</div>
<!-- End replaced content -->

<?php require "footer.php" ?>
